<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: AugusDuan
  Date: 2017/12/1
  Time: 15:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="${pageContext.request.contextPath}/">
    <title>毕业设计项目</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <script src="script/common.js"></script>
    <script type="text/javascript" src="js/jquery-1.9.0.js"></script>


    <script>

    </script>

    <script>


        $(function () {
            onloadCst();
        });
        function onloadCst(url) {
            var _lstCustName = $("#lstCustName").val();
            var _lstCustManagerName = $('#lstCustManagerName').val();
            var _lstStatus = $("#lstStatus  option:selected").val();
            if(!url){
                url = "cstLost/showCstLostAllAjax1?lstCustName="
                    +_lstCustName+"&lstCustManagerName="+_lstCustManagerName+"&lstStatus="+_lstStatus;
            }
            $('#loadTable').load(url,function () {
                var _lstLastOrderDate = $(".lstLastOrderDate");
                var lstLostDate = $(".lstLostDate");
                $.each(_lstLastOrderDate,function (i,item) {
                    var time = $.myTime.UnixToDate($(item).text());
                    $(this).html(time);
                })
                $.each(lstLostDate,function (i,item) {
                    var time = $.myTime.UnixToDate($(item).text());
                    $(this).html(time);
                })
            });
        }
        (function($) {
            $.extend({
                myTime: {
                    UnixToDate: function(unixTime, isFull, timeZone) {
                        if (typeof (timeZone) == 'number')
                        {
                            unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
                        }
                        var time = new Date(unixTime * 1000);
                        var ymdhis = "";
                        ymdhis += time.getUTCFullYear() + "-";
                        ymdhis += (time.getUTCMonth()+1) + "-";
                        ymdhis += time.getUTCDate();
                        if (isFull === true)
                        {
                            ymdhis += " " + time.getUTCHours() + ":";
                            ymdhis += time.getUTCMinutes() + ":";
                            ymdhis += time.getUTCSeconds();
                        }
                        return ymdhis;
                    }
                }
            });
        })(jQuery);
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("td.lstLastOrderDate").each(function () {
                alert("--");
                var text = $(this).text();
                text=parseInt(text,10);
                var unixToDate = $.myTime.UnixToDate(text);
                $(this).html(unixToDate);
            });

            $("td.lstLostDate").each(function () {
                var text = $(this).text();
                text=parseInt(text,10);
                var unixToDate = $.myTime.UnixToDate(text);
                $(this).html(unixToDate);
            });
        });
    </script>
</head>
<body>

<div class="page_title">客户流失管理</div>
<div class="button_bar">
    <button class="common_button" onclick="help('');">帮助</button>
    <button class="common_button" onclick="onloadCst();">查询</button>
</div>
<table class="query_form_table">
    <tr>
        <th>客户</th>
        <td><input type="text" id="lstCustName"/></td>
        <th>客户经理</th>
        <td><input type="text" id="lstCustManagerName"/></td>
        <th>状态</th>
        <td>
            <select id="lstStatus">
                <option value="">全部</option>
                <option value="预警">预警</option>
                <option value="暂缓流失">暂缓流失</option>
                <option value="确定流失">确定流失</option>
            </select>
        </td>
    </tr>
</table>
<br/>
<div id="loadTable">

</div>
<br/>

</body>
</html>